package com.xmut.rc.controller;


import com.xmut.rc.common.Result;
import com.xmut.rc.service.UserRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @description: 用户角色管理
 * @author: XS
 * @date: 2022/5/23
 */
@Api(tags = "用户角色管理")
@RestController
@RequestMapping("/system/user-role")
@Slf4j
public class UserRoleController {
    @Autowired
    private UserRoleService userRoleService;

    /**
     * 获取全部角色
     *
     * @return
     */
    @ApiOperation(value = "更新用户角色", notes = "更新用户角色")
    @GetMapping("/updateUserRole")
    public Result<?> updateUserRole(@RequestParam(name = "userId") String userId,
                                    @RequestParam(name = "roleIds") String roleIds) {
        boolean result = userRoleService.updateUserRole(userId, roleIds);
        if (result){
            return Result.OK("操作成功");
        }else {
            return Result.error("操作失败");
        }
    }
}

